#include <windows.h>
#include <string>

using namespace std;

string getBasePath(string path){
    size_t f = path.find_last_of("\\/");
    if (f == string::npos) return string("");
    return path.erase(f);
}

string getFileName(string path){
    size_t f = path.find_last_of("\\/");
    if (f == string::npos) return path;
    return path.erase(0,f+1);
}

string getExeFilePath(){
    char filename[MAX_PATH];
    int r = GetModuleFileName(NULL,filename,MAX_PATH);
    if (!r) return false;
    string fn(filename);
    return fn;
}

string getExeDirectory(){
    return getBasePath(getExeFilePath());
}

string getExeFileName(){
    return getFileName(getExeFilePath());
}
